package com.itheima.springbootwebtlias.mapper;

import com.github.pagehelper.Page;
import com.itheima.springbootwebtlias.pojo.Clazz;
import com.itheima.springbootwebtlias.pojo.ClazzQueryParam;
import com.itheima.springbootwebtlias.pojo.Emp;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface ClazzMapper {

    // 添加班级
    @Insert("insert into clazz (id, name, room, begin_date, end_date, master_id, subject, create_time, update_time) values (null,#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void addClazzs(Clazz clazz);

    //查询所有班级
    @Select("select * from clazz;")
    List<Clazz> selectAll();


    //班级列表分页查询
    Page<Clazz> selectByCondition(ClazzQueryParam queryParam);

    //删除班级
    @Delete("delete from clazz where id = #{id};")
    void deleteById(Integer id);

    //根据id查询班级
    @Select("select * from clazz where id = #{id};")
    Clazz findById(Integer id);

    @Update("update clazz set id = #{id},name = #{name}, room = #{room},begin_date = #{beginDate},end_date = #{endDate},master_id = #{masterId},subject = #{subject}  where id = #{id};")
    void update(Clazz clazz);

}
